// @ts-nocheck
import { GET, POST } from 'fastify-decorators';
import { z } from 'zod';
import { FastifyReply, FastifyRequest } from 'fastify';
import { Prisma } from '@prisma/client';
import { Base } from './base';

export abstract class BaseController<
    T extends keyof Prisma.GlobalOmitConfig,
    U extends z.ZodRawShape
> extends Base<T, U> {
    protected abstract model(): T;
    protected abstract createSchema(): z.ZodObject<U>

    @POST('/create')
    async create(request: FastifyRequest, reply: FastifyReply) {
        await super.create(request, reply);
    }

    @GET('/get')
    async get(request: FastifyRequest, reply: FastifyReply) {
        await super.get(request, reply);
    }

    @GET('/query/:id')
    async query(request: FastifyRequest, reply: FastifyReply) {
        await super.query(request, reply);
    }

    @POST('/update/:id')
    async update(request: FastifyRequest, reply: FastifyReply) {
        await super.update(request, reply);
    }

    @POST('/delete/:id')
    async delete(request: FastifyRequest, reply: FastifyReply) {
        await super.delete(request, reply);
    }
}